//
// CAnalogInputFilters.h
//

#ifndef __H_CAnalogInputFilters__
#define __H_CAnalogInputFilters__

#include "CLiveInputFilters.h"

class CCrossbar;
class CVideoCaptureFilter;
class CAudioCaptureFilter;
class COverlayMixerFilter;
class CAnalogInputFilters : public CLiveInputFilters
{
protected:
	CVideoCaptureFilter *	mVideoCapture;
	CAudioCaptureFilter *   mAudioCapture;
	COverlayMixerFilter *   mOverlayMixer;

	BOOL					mHasPreviewPin;
	CCrossbar *				mCrossbar;
	ICaptureGraphBuilder2 * mGraphBuilder;

protected:
	const DWORD     cNTSCMaskBits;
	const DWORD     cPALMaskBits;
	const DWORD     cSECAMMaskBits;

public:
	CAnalogInputFilters(CDXGraph * inGraph);
	virtual ~CAnalogInputFilters();

public:
	virtual BOOL Create(void);

	virtual BOOL IsAGPCard(void);
	virtual IPin * GetVideoOutPin(void);
	virtual IPin * GetPreviewPin(void);
	virtual IPin * GetAudioOutPin(void);

	virtual long GetVideoConnectorCount(void);
	virtual CString GetVideoConnectorName(long inIndex);
	virtual long GetVideoConnectorType(long inIndex);
	virtual void SetVideoConnector(long inPhysicalType);

	virtual Signal_Resolution GetVideoResolution(void);
	virtual void SetVideoResolution(Signal_Resolution inResolution);
	virtual long GetAllTVFormats(void);

	virtual long GetAudioConnectorCount(void);
	virtual CString GetAudioConnectorName(long inIndex);
	virtual void SetAudioConnector(long inIndex);
	virtual void SetAudioMixLevel(double inLevel);

	virtual void ShowVideoCapturePropertyPage(void);
	virtual BOOL IsActiveDeviceLost(IUnknown * pLost);

	// Image adjusting
	BOOL ImageAdjust_GetRange(long Property, long *pMin, long *pMax,
		long *pSteppingDelta, long *pDefault, long *pCapsFlags);
	BOOL ImageAdjust_Set(long Property, long lValue, long Flags);
	BOOL ImageAdjust_Get(long Property, long *lValue, long *Flags);

	// VFW setting dialogs
	BOOL VFWHasDialog(int inDlgType);
	void VFWShowDialog(int inDlgType, HWND hwnd);

protected:
	virtual void Release(void);
	
	IPin * FindVideoPin(const GUID * inCategory);
	IAMAnalogVideoDecoder * GetAnalogDecoder(void);
	IAMStreamConfig * GetStreamConfig(const GUID * inCategory);

	BOOL CreateCrossBar(IBaseFilter * inFilter);

	AM_MEDIA_TYPE * SelectMediaType(void);
	AM_MEDIA_TYPE * SelectMediaTypeForVMR(void);
	void AdjustOutput(void);
	void AdjustOutputToMax(void);  // Demo
	// Check to see if we should insert a smart tee filter
	void CheckSmartTee(void);
};

#endif // __H_CAnalogInputFilters__